import axios from 'axios'


const instance = axios.create({
    baseURL: 'https://reactapi.iynn.cn',
    timeout: 5000,
    headers: {'Content-Type': 'application/json'}
  });

  // 添加请求拦截器
  instance.interceptors.request.use(function (config) {
    if(localStorage.getItem('jwt')){
      config.headers.Authorization = localStorage.getItem('jwt')
    }
    return config;
  }, function (error) {
    return Promise.reject(error);
  });

// 添加响应拦截器
instance.interceptors.response.use(function (response) {

    return response;
  }, function (error) {

    return Promise.reject(error);
  });

export default instance